//
// Created by 28365 on 2025/3/14.
//

#include <chrono>
#include "../include/config/transmit/BasisStreamTransmit.h"

void BasisStreamTransmit::postTransmit(size_t nowTransmissionSize,size_t transmissionSize, size_t fileSize, const Res &res,
                                       const ODUpdater &odUpdater) {
    time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
    if (now - lastShow > 1000){
        lastShow = now;
        odUpdater.getLogger()->debug("[" + to_string(res.getId()) + "]下载进度-->" +
            to_string((int)((transmissionSize * 100) / (fileSize * 100)) / 100) + "% | " +
            to_string(transmissionSize) + "/" + to_string(fileSize) + "字节");
    }
}

BasisStreamTransmit::~BasisStreamTransmit() = default;
